package template;

import java.util.Date;

class BasicClass{
    private String value;
    public void set(String val){
        value = val;
    }
    public String get(){
        return value;
    }
}
class Decorator extends BasicClass{
    protected BasicClass basic;
    public Decorator(BasicClass basic) {this.basic = basic;}

    @Override
    public void set(String val) {
        basic.set(val);
    }

    @Override
    public String get() {
        return basic.get();
    }
}

class TimeStampe extends Decorator{
    private final long timeStamp;
    public TimeStampe(BasicClass basic){
        super(basic);
        timeStamp = new Date().getTime();
    }
    public long getStamp() {
        return  timeStamp;
    }
}

class SerialNumbere extends Decorator{
    private static long counter = 1;
    private final long serialNumber = counter++;
    public SerialNumbere(BasicClass basic){
        super(basic);
    }
    public long getSerialNumber() {
        return serialNumber;
    }
}
public class Decoration {
    public static void main(String[] args){
        TimeStampe t = new TimeStampe(new BasicClass());
        TimeStampe t2 = new TimeStampe(new SerialNumbere(new BasicClass()));
        SerialNumbere s = new SerialNumbere(new BasicClass());
        SerialNumbere s2 = new SerialNumbere(new TimeStampe(new BasicClass()));

    }
}
